package view;
import javax.swing.JPanel;
import javax.swing.SpringLayout;
import javax.swing.JLabel;
import javax.swing.JSeparator;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;


public class IndentGeneration extends JPanel{
	private JTable table;
	public IndentGeneration() {
		SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JSeparator separator = new JSeparator();
		springLayout.putConstraint(SpringLayout.NORTH, separator, 80, SpringLayout.NORTH, this);
		
		springLayout.putConstraint(SpringLayout.WEST, separator, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, separator, -10, SpringLayout.EAST, this);
		add(separator);
		
		JLabel lblheading = new JLabel("INDENT");
		springLayout.putConstraint(SpringLayout.WEST, lblheading, 0, SpringLayout.WEST, separator);
		add(lblheading);
		
		JScrollPane scrollPane = new JScrollPane();
		springLayout.putConstraint(SpringLayout.SOUTH, lblheading, -12, SpringLayout.NORTH, scrollPane);
		springLayout.putConstraint(SpringLayout.NORTH, scrollPane, 128, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, scrollPane, 10, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.EAST, scrollPane, -10, SpringLayout.EAST, this);
		add(scrollPane);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
			},
			new String[] {
				" No.", "Item Code", "Item Description", "Requirement", "Balance", "Purchase", "Time Schedule"
			}
		) {
			boolean[] columnEditables = new boolean[] {
				false, false, false, false, false, false, false
			};
			public boolean isCellEditable(int row, int column) {
				return columnEditables[column];
			}
		});
		table.getColumnModel().getColumn(0).setPreferredWidth(45);
		table.getColumnModel().getColumn(2).setPreferredWidth(178);
		table.getColumnModel().getColumn(6).setPreferredWidth(86);
		scrollPane.setViewportView(table);
		
		JLabel lblSiteEngineer = new JLabel("SITE ENGINEER:");
		springLayout.putConstraint(SpringLayout.SOUTH, scrollPane, -6, SpringLayout.NORTH, lblSiteEngineer);
		springLayout.putConstraint(SpringLayout.WEST, lblSiteEngineer, 28, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, lblSiteEngineer, -10, SpringLayout.SOUTH, this);
		add(lblSiteEngineer);
		
		JLabel lblStoreManager = new JLabel("STORE MANAGER:");
		springLayout.putConstraint(SpringLayout.NORTH, lblStoreManager, 0, SpringLayout.NORTH, lblSiteEngineer);
		springLayout.putConstraint(SpringLayout.EAST, lblStoreManager, -185, SpringLayout.EAST, this);
		add(lblStoreManager);
	}

}
